package com.hellogood.yaohuo.server.dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;

import com.hellogood.yaohuo.server.db.DBHelper;
import com.hellogood.yaohuo.shared.entity.Cup;

public class CupDAO extends DBHelper {
	Logger log = Logger.getLogger(this.getClass());
	@Override
	public List<?> initializeObject(ResultSet rs) throws SQLException {
		List<Cup> list = new ArrayList<Cup>();
		if (rs != null) {
			while (rs.next()) {
				Cup cup = new Cup();
				cup.setCup(rs.getString("Cup"));
				list.add(cup);
			}
		}
		return list;
	}
	
	@SuppressWarnings("unchecked")
	public List<Cup> getAllCup(){
		String sql = "SELECT * FROM CUP ORDER BY CUP";
		List<?> list = super.query(sql);
		return (List<Cup>) list;
	}
}
